package org.benjamin.lending.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.benjamin.lending.domain.entity.MemberIdentity;
import org.benjamin.lending.domain.entity.MemberMoney;
import org.benjamin.lending.service.MemberService;
import org.benjamin.lending.utils.CommonsUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by xywen on 2017/5/24.
 */
@Controller
@RequestMapping("withdraw")
public class WithdrawController {

    public final Logger logger = LogManager.getLogger();

    @Autowired
    private MemberService memberService;

    @RequestMapping(value = "index")
    public String index(ModelMap modelMap){
        logger.info("用户打开提现页面");
        String username = CommonsUtils.getSessionUser();
        MemberIdentity memberIdentity = this.memberService.findIdentityByUsername(username);
        MemberMoney memberMoney = this.memberService.findByMoneyByUsername(username);
        modelMap.addAttribute("memberIdentity",memberIdentity);
        modelMap.addAttribute("memberMoney",memberMoney);
        return "withdraw.index";
    }
}
